﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace WgpgGUI
{
    [ValueConversion(typeof(MessageBoxImage), typeof(ImageSource))]
    public class CustomMessageBoxImageConverter : IValueConverter
    {
        public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            MessageBoxImage image = (MessageBoxImage)value;
            switch (image)
            {
                case MessageBoxImage.Information: /* Asterisk has the same value. */
                    return new BitmapImage(new Uri("/WgpgCore;component/Images/MessageBox_Information.png", UriKind.Relative));
                case MessageBoxImage.Error: /* Hand and Stop have the same value. */
                    return new BitmapImage(new Uri("/WgpgCore;component/Images/MessageBox_Error.png", UriKind.Relative));
                case MessageBoxImage.Warning: /* Exclamation has the same value. */
                    return new BitmapImage(new Uri("/WgpgCore;component/Images/MessageBox_Warning.png", UriKind.Relative));
                case MessageBoxImage.Question:
                    return new BitmapImage(new Uri("/WgpgCore;component/Images/MessageBox_Question.png", UriKind.Relative));
                default:
                    return null;
            }
        }

        public Object ConvertBack(Object value, Type targetType, Object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
